<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<script src="<?= base_url() ?>js/chosen.jquery.js" type="text/javascript"></script>
<!-- CSS -->
<!--<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/datepicker.css" media="screen, tv, projection" title="Default" />
<script type="text/javascript" src="<?= base_url() ?>js/datepicker.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>css/chosen.css" />

<div id="container">
	<?
    //Setting Awal Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	$value = array(
		'id_unit_org'			=> "",
		'nama_unit'				=> "",
		'eselon'				=> "",
		'direktur'				=> "",
		'legend'				=> "Form Input Unit Organisasi",
		'info'					=> "Form input unit organisasi",
		'act_form'				=> "unit_organisasi/input_unit/"
	);
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
		foreach($unit_org->result() as $row){
			$value['id_unit_org'] = $row->ID_UNIT_ORGANISASI;
			$value['nama_unit'] = $row->NAMA_UNIT;
			$value['eselon'] = $row->ESELON;
			$value['direktur'] = $row->DIREKTUR;
		}
		$value['legend'] = "Form Edit Unit Organisasi";
		$value['info'] = "Form edit unit organisasi";
		$value['act_form'] = "unit_organisasi/edit_unit/".$value['id_unit_org'];
	}//end if
	
	?>
	<?= form_open($value["act_form"],'class="wufoo" name="form_unit_organisasi"'); ?>
	<fieldset class="fieldset">
	<legend class="legend">
		<?= $value["legend"] ?> |
	</legend>
	
	<div class="info">
		<div><?= $value["info"] ?></div>
	</div>
	<div>
		<?= anchor(site_url('unit_organisasi'),img(array('src'=>'images/main/38.png','border'=>'0','alt'=>'')).' Kembali ke daftar unit organisasi','Menampilkan halaman Daftar Unit Organisasi'); ?>
	</div>
 <!-- Konten -------------------------------------------------------------------------->
 <div id="contentform">
	<ul>
		
		<li>
			<label class="desc">Nama Unit Organisasi *</label>
			<div>
				<input class="field text large" type="text" maxlength="255" size="3" name="nama_unit" value="<? if(set_value('nama_unit')!='') echo set_value('nama_unit'); else echo $value['nama_unit'];?>"/> 
			</div>
			<p class="instruct">
				Masukkan Nama Unit Organisasi Pada Kolom ini.			
			</p>
		</li>
		<?php echo form_error('nama_unit'); ?>
		
		<li>
            <label class="desc">Eselon *</label>
            <div>
                <? 
                //list eselon
				$options_eselon[''] = "-- Pilih Eselon --";
				$options_eselon[1] = "Eselon I";
				$options_eselon[2] = "Eselon II";
				echo form_dropdown('eselon',$options_eselon,$value['eselon'],'class="field select"');	
                ?>
            </div>
            <p class="instruct">
                Pilih Eselon Pada Kolom ini.			
            </p>
        </li>
        <?php echo form_error('eselon'); ?>
		
		<li>
            <label class="desc">Jabatan Tertinggi</label>
            <div>
                <? 
                //list direktur
				$options_user[''] = "-- Pilih Jabatan --";
				foreach($pegawai->result() as $row){
					$options_user[$row->ID_USER] = $row->JABATAN; 
				}
				echo form_dropdown('direktur',$options_user,$value['direktur'],'class="chzn-select"');	
                ?>
            </div>
            <p class="instruct">
                Pilih Jabatan Tertinggi Pada Kolom ini, jika tidak ada dalam daftar maka inputkan pada manajemen user terlebih dahulu.			
            </p>
        </li>
        <?php echo form_error('direktur'); ?>
		
		<li class="buttons">
		  <input id="saveForm" class="btTxt" type="submit" value="Simpan" />
		  <input name="submit" type="reset" value="Batal" />
		</li>
	</ul>
</div>
</fieldset>
<script type="text/javascript">
  $(".chzn-select").chosen();
  $(".chzn-select-deselect").chosen({allow_single_deselect:true});
</script>	
<?= form_close(); ?>
</form>
</div><!--container-->